#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "ExpansionKind.h"
#include "StructuredActivityNode.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class ExpansionNode;

/// <summary>
/// ExpansionRegion
/// An ExpansionRegion is a StructuredActivityNode that executes its content
/// multiple times corresponding to elements of input collection(s).
/// </summary>
class UMLMODEL_EXPORT ExpansionRegion : public StructuredActivityNode {

public: // Constructors and destructors
    explicit ExpansionRegion(const QString& umlType="uml::ExpansionRegion");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// inputElements getter
    /// The ExpansionNodes that hold the input collections for the ExpansionRegion.
    /// </summary>
    vector<shared_ptr<ExpansionNode>>& inputElements();

    /// <summary>
    /// mode getter
    /// The mode in which the ExpansionRegion executes its contents. If parallel,
    /// executions are concurrent. If iterative, executions are sequential. If stream, a
    /// stream of values flows into a single execution.
    /// </summary>
    ExpansionKind mode() const;

    /// <summary>
    /// mode setter
    /// The mode in which the ExpansionRegion executes its contents. If parallel,
    /// executions are concurrent. If iterative, executions are sequential. If stream, a
    /// stream of values flows into a single execution.
    /// </summary>
    void setMode(ExpansionKind value);

    /// <summary>
    /// outputElements getter
    /// The ExpansionNodes that form the output collections of the ExpansionRegion.
    /// </summary>
    vector<shared_ptr<ExpansionNode>>& outputElements();

private: // Fields
    /// <summary>
    /// inputElements
    /// The ExpansionNodes that hold the input collections for the ExpansionRegion.
    /// </summary>
    vector<shared_ptr<ExpansionNode>> inputElements_;

    /// <summary>
    /// mode
    /// The mode in which the ExpansionRegion executes its contents. If parallel,
    /// executions are concurrent. If iterative, executions are sequential. If stream, a
    /// stream of values flows into a single execution.
    /// </summary>
    ExpansionKind mode_ = ExpansionKind::kiterative;

    /// <summary>
    /// outputElements
    /// The ExpansionNodes that form the output collections of the ExpansionRegion.
    /// </summary>
    vector<shared_ptr<ExpansionNode>> outputElements_;

};

} // namespace uml
